<?php

namespace app\index\controller;

use think\Request;

use app\index\model\Topic as TopicModel;
use app\index\model\Category as CategoryModel;

class Category extends Core
{
    /**
     * 显示指定的资源
     *
     * @param  int  $id
     * @return \think\Response
     */
    public function read(Response $request, $id)
    {
        $category = CategoryModel::find($id);
        $this->assign('category', $category);

        $param = $request->only(['order'], 'get');
        $param['category_id'] = $id;

        $paginate = TopicModel::minePaginate($param);
        $this->assign('paginate', $paginate);

        return $this->fetch('topic/index');
    }
}
